/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page, TreeDataModel } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface ShopExtendClsInv extends BasicModel<ShopExtendClsInv> {
  clsCode?: string; // 系列编码
  invCode?: string; // 存货编码
}

export const shopExtendClsInvList = (params?: ShopExtendClsInv | any) =>
  defHttp.get<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/list',
    params,
  });

export const shopExtendClsInvListData = (params?: ShopExtendClsInv | any) =>
  defHttp.post<Page<ShopExtendClsInv>>({
    url: adminPath + '/shop/product/shopExtendClsInv/listData',
    params,
  });

export const shopExtendClsInvForm = (params?: ShopExtendClsInv | any) =>
  defHttp.get<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/form',
    params,
  });

export const shopExtendClsInvSave = (params?: any, data?: ShopExtendClsInv | any) =>
  defHttp.postJson<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/save',
    params,
    data,
  });

export const shopExtendClsInvImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/shop/product/shopExtendClsInv/importData',
      onUploadProgress,
    },
    params,
  );

export const shopExtendClsInvDelete = (params?: ShopExtendClsInv | any) =>
  defHttp.get<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/delete',
    params,
  });

export const shopExtendClsInvTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({
    url: adminPath + '/shop/product/shopExtendCls/treeData',
    params,
  });

export const batchSaveInv = (params?: any, data?: ShopExtendClsInv | any) =>
  defHttp.postJson<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/batchSaveInv',
    params,
    data,
  });

export const batchSaveSell = (params?: any, data?: ShopExtendClsInv | any) =>
  defHttp.postJson<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/batchSaveSell',
    params,
    data,
  });

export const cancelInv = (params?: any, data?: ShopExtendClsInv | any) =>
  defHttp.postJson<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/cancelInv',
    params,
    data,
  });


  export const updateFbStatus = (params?: any, data?: ShopExtendClsInv | any) =>
  defHttp.postJson<ShopExtendClsInv>({
    url: adminPath + '/shop/product/shopExtendClsInv/updateFbStatus',
    params,
    data,
  });
  